<?php
/*
Plugin Name: OnStyle editor for Wordpress
Description: Interactively edit individual post's design.
Version: 0.1
Author: Daigo Tanaka
Author URI: http://daigotanaka.org
*/

add_action('get_footer','onstyle_editor');
define('ONSTYLE_EDITOR_DIR',plugin_dir_url(__FILE__));

function onstyle_editor() {
//  $onstyle = ONSTYLE_EDITOR_DIR . "/onstyle";
  $onstyle = "http://daigotanaka.org/onstyle";
  if (isset($_GET['preview'])){
    $onStyleVersion = "";
    if ( isset($_GET['osver']) ){
      $onStyleVersion = "-" . $_GET['osver'];
    }
    echo "<script type='text/javascript' src='" . $onstyle . "/onstyle" . $onStyleVersion . ".js'></script>\n";
  }
}
